unit editscriptform;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, SynEdit, SynHighlighterJScript, Forms, Controls,
  Graphics, Dialogs, StdCtrls, ExtCtrls, nkTitleBar, nkResizer, BCLabel,
  BCButton;

type

  { TfrmEditScript }

  TfrmEditScript = class(TForm)
    BCButton2: TBCButton;
    BCLabel1: TBCLabel;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    nkResizer1: TnkResizer;
    nkTitleBar1: TnkTitleBar;
    Panel1: TPanel;
    Panel2: TPanel;
    Panel3: TPanel;
    SynEdit1: TSynEdit;
    SynJScriptSyn1: TSynJScriptSyn;
    procedure BCButton2Click(Sender: TObject);
    procedure BCLabel1Click(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
    procedure FormShow(Sender: TObject);
    procedure SynEdit1Change(Sender: TObject);
    procedure SynEdit1ChangeUpdating(ASender: TObject; AnUpdating: Boolean);
  private

  public

  end;

var
  frmEditScript: TfrmEditScript;

implementation

{$R *.frm}

{ TfrmEditScript }

procedure TfrmEditScript.BCLabel1Click(Sender: TObject);
begin
  ModalResult:=mrCancel;
end;

procedure TfrmEditScript.FormCloseQuery(Sender: TObject; var CanClose: boolean);
begin
  if ModalResult=mrOK then
  begin
    if Trim(ComboBox2.Text)='' then
    begin
      ComboBox2.Text:='其他';
    end;
    if Trim(Edit1.Text)='' then
    begin
      MessageDlg('请输入该例程的简要名称或描述。',mtWarning,[mbOK],0);
      Edit1.SetFocus;
      CanClose:=False;
      Exit;
    end;
    if Trim(Edit2.Text)='' then
    begin
      MessageDlg('请输入完整的触发地址。',mtWarning,[mbOK],0);
      Edit2.SetFocus;
      CanClose:=False;
      Exit;
    end;
  end;
end;

procedure TfrmEditScript.BCButton2Click(Sender: TObject);
begin
  ModalResult:=mrOK;
end;

procedure TfrmEditScript.FormShow(Sender: TObject);
begin
  SynEdit1.SetFocus;
end;

procedure TfrmEditScript.SynEdit1Change(Sender: TObject);
begin
end;

procedure TfrmEditScript.SynEdit1ChangeUpdating(ASender: TObject;
  AnUpdating: Boolean);
begin
  Label6.Caption:='行：'+inttostr(SynEdit1.CaretY)+'   列：'+inttostr(SynEdit1.CaretX);

end;

end.

